package 比屋作业.day18;
import java.util.*;
public class D18_2 {
    public static void main(String[] args) {
        TreeSet<String> treeSet=new TreeSet<>(new Comparator<String>() {
            @Override
            public int compare(String o1, String o2) {
                int lengthDiff=o1.length()-o2.length();
                if (lengthDiff!=0){
                    return lengthDiff;
                }
                return o1.compareTo(o2);
            }
        });
        treeSet.add("世界");
        treeSet.add("你好");
        treeSet.add("C++");
        treeSet.add("Java");
        treeSet.add("我爱编程");
        treeSet.add("Python");
        treeSet.add("JavaScript");
        for (String string:treeSet){
            System.out.println(string);
        }
    }
}
